module EntryImage
  module EntryImagesController
    # GET /entry_images
    # GET /entry_images.xml
    def index
      @entry_images = EntryImage.find(:all)
      
      respond_to do |format|
        format.html # index.html.erb
        format.xml  { render :xml => @entry_images }
      end
    end
    
    # GET /entry_images/1
    # GET /entry_images/1.xml
    def show
      @entry_image = EntryImage.find(params[:id])
      
      respond_to do |format|
        format.html # show.html.erb
        format.xml  { render :xml => @entry_image }
      end
    end
    
    # GET /entry_images/new
    # GET /entry_images/new.xml
    def new
      @entry_image = EntryImage.new
      
      respond_to do |format|
        format.html # new.html.erb
        format.xml  { render :xml => @entry_image }
      end
    end
    
    # GET /entry_images/1/edit
    def edit
      @entry_image = EntryImage.find(params[:id])
    end
    
    # POST /entry_images
    # POST /entry_images.xml
    def create
      @entry_image = EntryImage.new(params[:entry_image])
      
      respond_to do |format|
        if @entry_image.save
          flash[:notice] = 'EntryImage was successfully created.'
          format.html { redirect_to(@entry_image) }
          format.xml  { render :xml => @entry_image, :status => :created, :location => @entry_image }
        else
          format.html { render :action => "new" }
          format.xml  { render :xml => @entry_image.errors, :status => :unprocessable_entity }
        end
      end
    end
    
    # PUT /entry_images/1
    # PUT /entry_images/1.xml
    def update
      @entry_image = EntryImage.find(params[:id])
      
      respond_to do |format|
        if @entry_image.update_attributes(params[:entry_image])
          flash[:notice] = 'EntryImage was successfully updated.'
          format.html { redirect_to(@entry_image) }
          format.xml  { head :ok }
        else
          format.html { render :action => "edit" }
          format.xml  { render :xml => @entry_image.errors, :status => :unprocessable_entity }
        end
      end
    end
    
    # DELETE /entry_images/1
    # DELETE /entry_images/1.xml
    def destroy
      @entry_image = EntryImage.find(params[:id])
      @entry_image.destroy
      
      respond_to do |format|
        format.html { redirect_to(entry_images_url) }
        format.xml  { head :ok }
      end
    end
  end
end